package com.jy.oms.framework.asyn.task.exception;

/**
 * 任务不重试异常；
 * 使用场景：任务定义了重试次数，在大部分异常场景下，重试是没必要的，
 * 当框架捕获此异常时将终止任务，不再重试
 *
 * @author liuquan
 */
public class TaskNeverRetryException extends RuntimeException {

    private boolean saveLog;
    private boolean alarm;

    public TaskNeverRetryException(String msg) {
        super(msg);
        this.saveLog = true;
        this.alarm = false;
    }

    public TaskNeverRetryException(String msg, boolean saveLog) {
        super(msg);
        this.saveLog = saveLog;
        this.alarm = false;
    }

    public TaskNeverRetryException(String msg, Throwable throwable) {
        super(msg, throwable);
    }

    public TaskNeverRetryException(String msg, Throwable throwable, boolean alarm) {
        super(msg, throwable);
        this.alarm = alarm;
    }

    public boolean isSaveLog() {
        return saveLog;
    }

    public void setSaveLog(boolean saveLog) {
        this.saveLog = saveLog;
    }

    public boolean isAlarm() {
        return alarm;
    }

    public void setAlarm(boolean alarm) {
        this.alarm = alarm;
    }
}
